/*
-----------------------------------------------------------------------------
This source file is part of DIVA
The project of Engineering Lab, dept. of CSIE, NTNU.

Copyright (c) 2000-2006 The Engineering Lab, dept. of CSIE, NTNU.
-----------------------------------------------------------------------------
Filename:    ArithFactory.h
Description: 將不同的開頭對應到不同的處理函式
			 如int=>Arith_int
-----------------------------------------------------------------------------
*/

#ifndef _Arith_Factory_H_
#define	_Arith_Factory_H_

#include "MyWord.h"

class ArithFactory{
public:

	static ArithFactory* getInstance();
	MyWord* computeArith(std::string arith,std::vector<MyWord*>* childs);

private:

	ArithFactory(){};
	static ArithFactory* arithFracory;
	void clearList(std::vector<MyWord*>* list);

	MyWord*	computeSum(std::vector<MyWord*>* childs);
	MyWord* computeSub(std::vector<MyWord*>* childs);
	MyWord* computeMul(std::vector<MyWord*>* childs);
	MyWord* computeDiv(std::vector<MyWord*>* childs);
	MyWord*	computeNegative(std::vector<MyWord*>* childs);
	MyWord* computeSqrt(std::vector<MyWord*>* childs);
	MyWord* computeCeil(std::vector<MyWord*>* childs);
	MyWord* computeFloor(std::vector<MyWord*>* childs);
	MyWord* computeSin(std::vector<MyWord*>* childs);
	MyWord* computeCos(std::vector<MyWord*>* childs);
	MyWord* computeTan(std::vector<MyWord*>* childs);
	MyWord* computeAsin(std::vector<MyWord*>* childs);
	MyWord* computeAcos(std::vector<MyWord*>* childs);
	MyWord* computeAtan(std::vector<MyWord*>* childs);
	MyWord* computeLog(std::vector<MyWord*>* childs);
	MyWord* computeLog10(std::vector<MyWord*>* childs);
	MyWord* computePow(std::vector<MyWord*>* childs);
	MyWord* computeToInt(std::vector<MyWord*>* childs);
	MyWord* computeExp(std::vector<MyWord*>* childs);
	MyWord* computeMod(std::vector<MyWord*>* childs);
	MyWord* computeAbs(std::vector<MyWord*>* childs);
	MyWord* computeResult(std::vector<MyWord*>* childs);
	
};

#endif 